package com.zoo.wuhua.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.zoo.wuhua.entity.JpaBook;

/**
 * @description
 * @author zhangli7@yusys.com.cn
 * @since 2020年2月16日 上午10:24:24 v1.0
 */
public interface JpaBookDao extends JpaRepository<JpaBook, Integer> {

    List<JpaBook> getJpaBooksByAuthorStartingWith(String author);

    List<JpaBook> getJpaBooksByPriceGreaterThan(Double price);

    @Query(value = "SELECT * FROM Book WHERE ID = (SELECT MAX(ID) FROM Book)", nativeQuery = true)
    JpaBook getMaxIdJpaBook();

}
